Pivoted sparse Cholesky for QuadtoSOCBridge.#2965
Pivoted sparse Cholesky for QuadtoSOCBridge.#2965samuelsonric wants to merge 1 commit intojump-dev:masterfrom
Conversation
|
I need to think about this more. This will conflict if someone loads both CliqueTrees and LDLFactoriztions. |
|
Ah good point. |
|
I'm also not very keen on adding dependencies. I wonder if we can just document this somehow. It's such a small edge-case. Very, very few people will ever need this. |
|
We haven't released the LDL stuff yet (#2955), so we have a small window to get this right. I'll take a look. |
|
Also takes |
|
Are there situations when LDLFactorizations is preferable to CliqueTrees? |
|
Yes: if the matrix is extremely sparse it can be ~2x faster. |
|
Is there a better way to check if the factorisation failed other than testing |
|
For example, your julia> Q = [0 -1; -1 0]
2×2 Matrix{Int64}:
0 -1
-1 0
julia> G = LinearAlgebra.cholesky!(
CliqueTrees.Multifrontal.ChordalCholesky(Q),
LinearAlgebra.RowMaximum(),
)
2×2 FChordalCholesky{:L, Float64, Int64} with 3 stored entries:
0.0 ⋅
0.0 0.0
julia> LinearAlgebra.issuccess(G)
true
julia> U = SparseArrays.sparse(G.U) * G.P
2×2 SparseArrays.SparseMatrixCSC{Float64, Int64} with 3 stored entries:
0.0 0.0
⋅ 0.0
julia> U' * U
2×2 SparseArrays.SparseMatrixCSC{Float64, Int64} with 4 stored entries:
0.0 0.0
0.0 0.0 |
|
LDLFactorizations halts early if it hits a zero pivot, so I think that you can just scan the diagonal. CliqueTrees (with You could try solving Fx = b for some random b and compare Qx to b. |
|
We truncate negative pivots to 0 when computing a pivoted factorization. I wasn't thinking about non-PSD matrices. I can change the behavior to something else. |
|
So is |
|
Currently, you cannot check for failure without solving a problem or reconstructing or something. However, I can push a patch tonight that sets Also -- beware. |
|
We just want a method that produces |
Right. The current status is this: CliqueTrees is robust for PSD (moreso than LDLFactorizations) but might produce strange results for non-PSD. Your breaking example ( |
This PR adds the pivoted sparse Cholesky factorization algorithm in CliqueTrees.jl as a fallback in QuadtoSOCBridge. This algorithm can handle singular matrices, and it is MIT licensed.
Example
The CliqueTrees factorization correctly reconstructs the matrix.
The LDLFactorizations factorization does not.
Related Pull Requests